class Institution < ActiveRecord::Base
	has_many :youths

  validates_presence_of :name
  validates_uniqueness_of :name

  before_destroy :validate_before_destroy

  def validate_before_destroy
    raise "Cannot delete institution while youths are assigned to it" if (self.youths.size > 0)
  end


end
